/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package entities;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author yoshi
 */
public class Roll {
    private long id;
    private String name;
    private boolean head;

    public Roll(ResultSet rs){
        this.loadFromResultSet(rs);
    }
    
    public Roll(long id, String name, boolean head) {
        this.id = id;
        this.name = name;
        this.head = head;
    }

    public boolean isHead() {
        return head;
    }

    public void setHead(boolean head) {
        this.head = head;
    }

    public long getId() {
        return id;
    }

    private void setId(long id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }
    
    public void loadFromResultSet(ResultSet rs){
        try {
            this.id = rs.getLong("id");
            this.name = rs.getString("name");
            this.head = rs.getBoolean("head");
        } catch (SQLException ex) {
            Logger.getLogger(Roll.class.getName()).log(Level.SEVERE, null, ex);
        }
    }
}
